using System;
using Flaschengeist.Entities;

namespace Flaschengeist.Processes 
{
	public class ValidateLevel
	{		
		private CompareTracks compareTracks;
		private float percentage = 0.75f;
		private int bonusCorrectNote = 100;
		
		
		public void Process(LevelResult levelResult)
		{
			float minNotes = levelResult.LevelTrack.Length*percentage;
            int minScore = (int)Math.Ceiling(minNotes * bonusCorrectNote);
			
			if(minScore <= (levelResult.CorrectNotesScore + levelResult.SimilarNotesScore))
				levelResult.Passed = true;
			else
				levelResult.Passed = false;

			Completed(levelResult);
		}
		
		public event Action<LevelResult> Completed;
	}
}